package pl.enigmatic.time;

import pl.enigmatic.util.Metrics;


public class TimeCounterDouble {

	private final TimeCounterLong longCounter;
	private final double factor;

	public TimeCounterDouble(final boolean nano) {
		if (nano) {
			longCounter = new TimeCounterNano();
			factor = Metrics.NANO;
		} else {
			longCounter = new TimeCounterMilli();
			factor = Metrics.MILLI;
		}
	}

	public TimeCounterDouble() {
		this(true);
	}

	public double restart() {
		return factor * longCounter.restart();
	}

	/**
	 * @return
	 * @see pl.enigmatic.time.TimeCounterLong#getMeasuredTime()
	 */
	public double getMeasuredTime() {
		return factor * longCounter.getMeasuredTime();
	}

	/**
	 * @return
	 * @see pl.enigmatic.time.TimeCounterLong#getElapsedTime()
	 */
	public double getElapsedTime() {
		return factor * longCounter.getElapsedTime();
	}

	public double getDelta() {
		return factor * longCounter.getDelta();
	}
}
